package com.alibaba.nacos.config.server.jpa.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

/**
 * @author
 * @date 2020-03-08 23:31
 * tenant_info
 */
@Entity
@Table(name = "NACOS_TENANT_INFO",
    indexes = {@Index(name = "IDX_TENANT_ID", columnList = "TENANT_ID")},
    uniqueConstraints = {
        @UniqueConstraint(name = "UK_TENANT_INFO_KPTENANTID", columnNames = {"KP", "TENANT_ID"})
    })
public class TenantInfoEntity extends AbstractEntity {

    private static final long serialVersionUID = 1L;

    public TenantInfoEntity () {}



    /**
     * create_source
     */
    @Column(name = "CREATE_SOURCE")
    private String createSource;

    /**
     * 创建时间
     */
    @Column(name = "GMT_CREATE", nullable = false, length = 20)
    @CreatedDate
    private Long gmtCreate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "GMT_MODIFIED", nullable = false, length = 20)
    private Long gmtModified;

    /**
     * kp
     */
    @Column(name = "KP", nullable = false)
    private String kp;

    /**
     * tenant_desc
     */
    @Column(name = "TENANT_DESC")
    private String tenantDesc;

    /**
     * tenant_id
     */
    @Column(name = "TENANT_ID")
    private String tenantId;

    /**
     * tenant_name
     */
    @Column(name = "TENANT_NAME")
    private String tenantName;

    public TenantInfoEntity setCreateSource(String createSource){
        this.createSource = createSource;
        return this;
    }

    public String getCreateSource(){
        return createSource;
    }

    public TenantInfoEntity setGmtCreate(Long gmtCreate){
        this.gmtCreate = gmtCreate;
        return this;
    }

    public Long getGmtCreate(){
        return gmtCreate;
    }

    public TenantInfoEntity setGmtModified(Long gmtModified){
        this.gmtModified = gmtModified;
        return this;
    }

    public Long getGmtModified(){
        return gmtModified;
    }

    public TenantInfoEntity setKp(String kp){
        this.kp = kp;
        return this;
    }

    public String getKp(){
        return kp;
    }

    public TenantInfoEntity setTenantDesc(String tenantDesc){
        this.tenantDesc = tenantDesc;
        return this;
    }

    public String getTenantDesc(){
        return tenantDesc;
    }

    public TenantInfoEntity setTenantId(String tenantId){
        this.tenantId = tenantId;
        return this;
    }

    public String getTenantId(){
        return tenantId;
    }

    public TenantInfoEntity setTenantName(String tenantName){
        this.tenantName = tenantName;
        return this;
    }

    public String getTenantName(){
        return tenantName;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("TenantInfoEntity = {");

        if (createSource != null){
            sb.append("createSource = ").append(createSource).append(", ");
        }
        if (gmtCreate != null){
            sb.append("gmtCreate = ").append(gmtCreate).append(", ");
        }
        if (gmtModified != null){
            sb.append("gmtModified = ").append(gmtModified).append(", ");
        }
        if (id != null){
            sb.append("id = ").append(id).append(", ");
        }
        if (kp != null){
            sb.append("kp = ").append(kp).append(", ");
        }
        if (tenantDesc != null){
            sb.append("tenantDesc = ").append(tenantDesc).append(", ");
        }
        if (tenantId != null){
            sb.append("tenantId = ").append(tenantId).append(", ");
        }
        if (tenantName != null){
            sb.append("tenantName = ").append(tenantName);
        }

        sb.append("}");
        return sb.toString();
    }

}
